<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var num = prompt('请输入班级总人数：');
        var score;
        var sum = 0;
        var arg = 0;
        for (var i = 1; i <= num; i++) {
            score = prompt('请输入第' + i + '个人的成绩');
            //因为从 prompt 取过来的数据是 字符串型的需要转换为数字型
            sum += parseFloat(score);
        }
        arg = sum / num;
        alert('班级的总成绩为：' + sum);
        alert('班级的平均成绩为：' + arg);
    </script>
</head>
<body>
    
</body>
</html>